﻿
namespace Storm.TextEditor.Editor
{
    /// <summary>
    /// Represents a class holding various information that the IPainter needs.
    /// </summary>
    public class ViewPoint
    {
        #region Fields

        private int yOffset = 0;
        private int charWidth = 0;
        private int firstVisibleColumn = 0;

        private int rowHeight = 0;
        private int firstVisibleRow = 0;
        private int visibleRowCount = 0;

        private int clientAreaWidth = 0;
        private int clientAreaStart = 0;

        private int gutterMarginWidth = 0;
        private int lineNumberMarginWidth = 0;
        private int totalMarginWidth = 0;
        private int textMargin = 0;

        private TextAction action = TextAction.None;

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets the offset of the screen in the Y-axis.
        /// </summary>
        public int YOffset
        {
            get { return yOffset; }
            set { yOffset = value; }
        }

        /// <summary>
        /// Gets or sets the height of a row in pixels.
        /// </summary>
        public int RowHeight
        {
            get { return rowHeight; }
            set { rowHeight = value; }
        }

        /// <summary>
        /// Gets or sets the width of a char in pixels.
        /// </summary>
        public int CharWidth
        {
            get { return charWidth; }
            set { charWidth = value; }
        }

        /// <summary>
        /// Gets or sets the index of the first visible row.
        /// </summary>
        public int FirstVisibleRow
        {
            get { return firstVisibleRow; }
            set { firstVisibleRow = value; }
        }

        /// <summary>
        /// Gets or sets the number of rows that can be displayed in the current view.
        /// </summary>
        public int VisibleRowCount
        {
            get { return visibleRowCount; }
            set { visibleRowCount = value; }
        }

        /// <summary>
        /// Gets or sets the index of the first visible column.
        /// </summary>     
        public int FirstVisibleColumn
        {
            get { return firstVisibleColumn; }
            set { firstVisibleColumn = value; }
        }

        /// <summary>
        /// Gets or sets the width of the client area in pixels.
        /// </summary>
        public int ClientAreaWidth
        {
            get { return clientAreaWidth; }
            set { clientAreaWidth = value; }
        }

        /// <summary>
        /// Gets or sets the height of the client area in pixels.
        /// </summary>
        public int ClientAreaStart
        {
            get { return clientAreaStart; }
            set { clientAreaStart = value; }
        }

        /// <summary>
        /// Gets or sets the TextAction that the TextEditor is currently performing.
        /// </summary>
        public TextAction Action
        {
            get { return action; }
            set { action = value; }
        }

        /// <summary>
        /// Gets or sets the width of the gutter margin in pixels.
        /// </summary>
        public int GutterMarginWidth
        {
            get { return gutterMarginWidth; }
            set { gutterMarginWidth = value; }
        }

        /// <summary>
        /// Gets or sets the width of the line number margin in pixels.
        /// </summary>
        public int LineNumberMarginWidth
        {
            get { return lineNumberMarginWidth; }
            set { lineNumberMarginWidth = value; }
        }

        /// <summary>
        /// Gets or sets the total width of the margins in pixels.
        /// </summary>
        public int TotalMarginWidth
        {
            get { return totalMarginWidth; }
            set { totalMarginWidth = value; }
        }

        /// <summary>
        /// Gets or sets the width of the TextMargin (Sum of gutter + line number + folding margins) in pixels.
        /// </summary>
        public int TextMargin
        {
            get { return textMargin; }
            set { textMargin = value; }
        }

        #endregion
    }
}
